/*
 * SNP.h
 *
 *  Created on: Feb 14, 2012
 *      Author: nhatuan
 *
 *
 *	Stores data and possible operations for each snp
 *	@param samples: a vector of samples
 *	@param snpName: name of current snp
 *	@param numberOfSamples: number of sample in current snp
 *	@param tDistributions: 3 t-distributions, illustrates three clusters
 *	@param outliers: samples which cannot be clustered
 */

#ifndef SNP_H_
#define SNP_H_


#include <fstream>
#include "Sample.h"
#include "TDistribution.h"
#include "utils.h"
#include <stdlib.h>

using namespace std;

static const Sample nullSample;

class SNP {
public:
	SNP();
	void assign1(string dataString, vector<string> sampleNames);
	virtual ~SNP();
	Sample getSampleByName(string name);
	Sample getAndRemovedSampleByName(string name);
	Sample removeAPoint(string name);
	void removeSamples(vector<string> names);
	void removeSamples(string name);
	void setName(string name);
	float calculateLogLikelihood();
	vector<Sample> getBadSamples();
	void assignData(string dataString, string * sampleNames);
	void assignData(string dataString, vector<string> sampleNames);
	void printData();

	string getName();
	int getNumberOfSamples();
	
	void removeSample(string name);
	void reAddSample();
	void display(double one[][3]);
	void compare(SNP snp);
	int getTsize(int index);
	
	bool saveToFile(string fileName);
	bool loadFromFile(string fileName);
	bool _saveToFile(string fileName);
	bool _loadFromFile(string fileName);

	TDistribution * tDistributions;
private:
	float ** getArrayData();
	int getIndexCluster(string indexData);
	void addNewPoint(string name, float x, float y, int index);
	vector<Sample> samples;
	string snpName;
	int numberOfSamples;
	
	vector<Sample> outliers;
	Sample currentRemovedSample;
	int location;
};

#endif /* SNP_H_ */
